<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
    <title><!--图片上传--></title>
    <meta charset="utf-8">
    <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" href="css/project/ui-res-v3.css">
    <link rel="stylesheet" href="css/project/ui-input-v3.css">
	<link rel="stylesheet" href="css/project/ui-btn-v3.css">
    <link rel="stylesheet" href="css/project/ui-color-v3.css">
	<link rel="stylesheet" href="css/project/style.css">
    <link rel="stylesheet" href="css/ui-base.css">
    <link rel="stylesheet" href="css/ui-box.css">
	<link rel="stylesheet" href="css/project/style.css">
	<link rel="stylesheet" href="css/zv_common.css">
	<script src="js/zy_control.js"></script>
	<script src="js/zy_click.js"></script>
	<script src="js/zy_json.js"></script>
	<script src="js/main.js"></script>
	<script src="js/init.js"></script>
	<script src="js/talkingdata.js"></script>
	<style>
		*{overflow:hidden;}
		body{ background:url(images/pic.png)  #6f6e6f center no-repeat; background-size:100%; overflow:hidden;}
	</style>
</head>
<body class="um-vp">
<input  id="dirPath" type="hidden" value="">
<input  id="ys" name ="是否压缩" type="hidden" value="1">
<div id="page_1" class="ub ub-ver um-vp" style="text-align:center;  background-repeat:no-repeat;  background-position:center; background-size:100%; height:100%;">

</div>
</body>
<script>
zy_init();
var cText = 0;
var cJson = 1;
var cInt = 2;
var uploadHttp = image_upload_add_url;//上传服务器端
alert(uploadHttp)
function openCamera()
{
	IC.talkingDataCount("遗留物品录入查询","0017");
	uexCamera.open();
}
function openPick()
{
	IC.talkingDataCount("遗留物品录入查询","0017");
	uexImageBrowser.pick();
}
function upload(){
	IC.talkingDataCount("遗留物品录入查询","0017");
	//创建一个上传对象
    uexUploaderMgr.createUploader(1, uploadHttp);
	//文件上传
	var dirPath = document.getElementById('dirPath').value;
	var ys = document.getElementById('ys').value;
	uexUploaderMgr.uploadFile(1, dirPath, "inputName", ys);
}
window.uexOnload = function(type){
	IC.talkingDataCount("遗留物品录入查询","0017");
	//打开相机start
	uexCamera.cbOpen = function(opCode, dataType, data){
    	switch (dataType) {
        	case cText:
            	document.getElementById('dirPath').value = data;
				//page_1 background
				document.getElementById('page_1').style.backgroundImage="url("+data+")";
				//alert(data);
				uexImageBrowser.save(data);
                //document.getElementById('picc').src = data;
				uescript("take_picuters","showDiv('upload')");
            	break;
            case cJson:
            	alert("uex.cJson");
            	break;
            case cInt:
                alert("uex.cInt");
                break;
            default:
            	alert("error");
    	}
	}
	//打开相机end
	
	//本地图库start
	uexImageBrowser.cbPick = function(opCode, dataType, data){
		document.getElementById('dirPath').value = data;
		document.getElementById('page_1').style.backgroundImage="url("+data+")";
		uescript("take_picuters","showDiv('upload')");
	}
	//本地图库end
	
	 //上传的状态start
	uexUploaderMgr.onStatus = function(opCode, fileSize, percent, serverPath, status){
		switch (status) {
			case 0:
				$toast("上传进度:"+percent+"%",0);
				uescript("take_picuters","showDiv('uploading')");
				//document.getElementById('percentage').innerHTML = "大小：" + fileSize + "字节<br>进度：" + percent + "%";
            	break;
            case 1:
				$closeToast();
				uescript("take_picuters","showDiv('opensheet')");
				//这里调用保存数据库路径接口
				
				//alert("上传成功，服务器路径为" + serverPath);
				//alert(serverPath)
				var itemCode=	localStorage.getItem("itemCode");
				//http://localhost:8080/ceair/ItemSoap?RequestKey=FDDBCAA11500948183F0299431B2B571&act=PicInputInfo&itemCode=PVG20141125001&itemPic=222&URL=http://172.28.28.21:5566/DfHbWebService/HbWebService.asmx
				var jsonPage =[{'key':'RequestKey','type':'0','value':RequestKey},{'key':'act','type':'0','value':'PicInputInfo'},{'key':'itemCode','type':'0','value':itemCode},{'key':'itemPic','type':'0','value':serverPath},{'key':'URL','type':'0','value':kitsch_entry_url}];
//				alert(itemCode);
//				alert(serverPath);
//				alert(kitsch_entry_url);
				//alert(host_address_url);
			//alert(JSON.stringify(jsonPage));
			 $.getJSON(host_address_url+"ItemSoap",function(json){
			 	//alert(json)
				if(json!='')
				{
					openNewWin('kitsch_success','kitsch_success.html');
				}
            },"json",function(e){},"POST",jsonPage,false);
				//关闭上传对象
				uexUploaderMgr.closeUploader(1);
				break;
			case 2:
				$closeToast();
				$alert("网络连接失败，请连接网络后上传");
				uescript("take_picuters","showDiv('upload','重新上传')");
				uexUploaderMgr.closeUploader(1);
				break;
		}
	}
	//上传的状态end
	//createUploader的回调函数,没有什么用，测试使用
	uexUploaderMgr.cbCreateUploader = function(opCode, dataType, data){
		if (data == 0) {
			//alert("创建成功");
		}
		else {
			//alert("创建失败");
		}
	}
}
</script>
</html>
